Skip to content

fix: add null checks and bounds validation for memory safety#12

Open
gavlooth wants to merge 2 commits intoHigherOrderCO:mainfrom
gavlooth:purple-work
Open

fix: add null checks and bounds validation for memory safety#12
gavlooth wants to merge 2 commits intoHigherOrderCO:mainfrom
gavlooth:purple-work

Conversation

@gavlooth
Copy link

Summary

  • Add null check after strdup in parse_include to handle allocation failure
  • Add bounds check for string parsing to prevent buffer overflow (max 4096 codepoints)
  • Add null check after malloc in table_find to handle allocation failure

Test plan

  • Existing tests pass
  • Manual testing with large strings to verify bounds check

🤖 Generated with Claude Code

- Add null check after strdup in parse_include
- Add bounds check for string parsing (max 4096 codepoints)
- Add null check after malloc in table_find

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Lorenzobattistela
Copy link
Collaborator

This probably has performance implications, doing bound validation is expensive. If possible / want us to review and merge, pls do benchmarking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants